package online.hxstart.code.dataalgorithm.chapter1;

/**
 * @author huxing
 * @date 2019/6/6 星期四 11:47
 * @describe OOP 面向对象
 */
public class C {
  private String dataFiled1;
  private int dataFiled2;
  private double dataFiled3;

  public C() {
    this(null, 1, 0);
  }

  public C(String dataFiled1) {
    this(dataFiled1, 1, 0);
  }

  public C(String dataFiled1, int dataFiled2, double dataFiled3) {
    this.dataFiled1 = dataFiled1;
    this.dataFiled2 = dataFiled2;
    this.dataFiled3 = dataFiled3;
  }

  private void method1() {
    System.out.println(dataFiled1 + " " + dataFiled2 + " " + dataFiled3);
  }

  private void method2(int i) {
    method2(i, "unknown");
  }

  private void method2(int i, String s) {
    dataFiled2 = i;
    System.out.println(i + " receive from " + s);
  }

  public static void main(String[] args) {

    System.out.println(Math.sqrt(4));
    C obj1 = new C("object1", 100, 2000), obj2 = new C("object2"), obj3 = new C();
    obj1.method2(123);
    obj1.method1();
    obj2.method2(123, "object2");
  }
}
